Scripting > CxHmiGrp > CxGrpNavBar Object > CxGrpNavBar Methods

CxGrpNavBar Methods

The CxGrpNavBar object contains the following methods:

AboutBox

The AboutBox method displays an About dialog box for the control.

Syntax

AboutBox()

Example

The following example displays the About dialog box.

Sub ShowAboutBox()

 

GrpNavBar.AboutBox

 

End Sub

Back to top

CanNavNext

The CanNavNext method specifies whether the next target item (facility or node) can be selected.

Syntax

CanNavNext(Wrap As Boolean) As Boolean

Parameters

Parameter Required Description

Wrap

Yes

If True, the selection wraps to the first node, if necessary.

Example

The following example disables btnNavNext if the next target node cannot be selected. This example is taken from CxGrpNavBar and CxGrpGrid Example.

Sub UpdateUI()

 

eboLevels.Text = GrpNavBar.X.Levels - 1

 

If cboLevel.Selection = 0 Then

eboRules.Text = GrpNavBar.X.RootNodeRules

Else

eboRules.Text = _GrpNavBar.X.Rules(CInt(cboLevel.GetText(cboLevel.Selection)))

End If

 

btnNext.Enable = GrpNavBar.X.CanSelNext(eboLevel.Text, ckbWrap.Value)

btnPrev.Enable = GrpNavBar.X.CanSelPrev(eboLevel.Text, ckbWrap.Value)

 

btnNavNext.Enable = GrpNavBar.X.CanNavNext(ckbNavWrap.Value)

btnNavPrev.Enable = GrpNavBar.X.CanNavPrev(ckbNavWrap.Value)

 

End Sub

Back to top

CanNavPrev

The CanNavPrev method specifies whether the previous target item (facility or node) can be selected.

Syntax

CanNavPrev(Wrap As Boolean) As Boolean

Parameters

Parameter Required Description

Wrap

Yes

If True, the selection wraps to the last node, if necessary.

Example

The following example disables btnNavPrev if the previous target node cannot be selected. This example is taken from CxGrpNavBar and CxGrpGrid Example.

Sub UpdateUI()

 

eboLevels.Text = GrpNavBar.X.Levels - 1

 

If cboLevel.Selection = 0 Then

eboRules.Text = GrpNavBar.X.RootNodeRules

Else

eboRules.Text = _GrpNavBar.X.Rules(CInt(cboLevel.GetText(cboLevel.Selection)))

End If

 

btnNext.Enable = GrpNavBar.X.CanSelNext(eboLevel.Text, ckbWrap.Value)

btnPrev.Enable = GrpNavBar.X.CanSelPrev(eboLevel.Text, ckbWrap.Value)

 

btnNavNext.Enable = GrpNavBar.X.CanNavNext(ckbNavWrap.Value)

btnNavPrev.Enable = GrpNavBar.X.CanNavPrev(ckbNavWrap.Value)

 

End Sub

Back to top

CanSelNext

The CanSelNext method returns True if the next item (facility attribute value or node) for the specified level can be selected. Otherwise returns False.

Syntax

CanSelNext(Level As Integer, Wrap As Boolean) As Boolean

Parameters

Parameter Required Description

Level

Yes

The zero-based integer of the level.

Wrap

Yes

If True, the selection wraps to the last node, if necessary.

Example

The following example disables btnNext if the next node cannot be selected. This example is taken from CxGrpNavBar and CxGrpGrid Example.

Sub UpdateUI()

 

eboLevels.Text = GrpNavBar.X.Levels - 1

 

If cboLevel.Selection = 0 Then

eboRules.Text = GrpNavBar.X.RootNodeRules

Else

eboRules.Text = _GrpNavBar.X.Rules(CInt(cboLevel.GetText(cboLevel.Selection)))

End If

 

btnNext.Enable = GrpNavBar.X.CanSelNext(eboLevel.Text, ckbWrap.Value)

btnPrev.Enable = GrpNavBar.X.CanSelPrev(eboLevel.Text, ckbWrap.Value)

 

btnNavNext.Enable = GrpNavBar.X.CanNavNext(ckbNavWrap.Value)

btnNavPrev.Enable = GrpNavBar.X.CanNavPrev(ckbNavWrap.Value)

 

End Sub

Back to top

CanSelPrev

The CanSelPrev method returns True if the previous item (facility attribute value or node) for the specified level can be selected. Otherwise returns False.

Syntax

CanSelPrev(Level As Integer, Wrap As Boolean) As Boolean

Parameters

Parameter Required Description

Level

Yes

The zero-based integer of the level.

Wrap

Yes

If True, the selection wraps to the last node, if necessary.

Example

The following example disables btnPrev if the previous node cannot be selected. This example is taken from CxGrpNavBar and CxGrpGrid Example.

Sub UpdateUI()

 

eboLevels.Text = GrpNavBar.X.Levels - 1

 

If cboLevel.Selection = 0 Then

eboRules.Text = GrpNavBar.X.RootNodeRules

Else

eboRules.Text = _GrpNavBar.X.Rules(CInt(cboLevel.GetText(cboLevel.Selection)))

End If

 

btnNext.Enable = GrpNavBar.X.CanSelNext(eboLevel.Text, ckbWrap.Value)

btnPrev.Enable = GrpNavBar.X.CanSelPrev(eboLevel.Text, ckbWrap.Value)

 

btnNavNext.Enable = GrpNavBar.X.CanNavNext(ckbNavWrap.Value)

btnNavPrev.Enable = GrpNavBar.X.CanNavPrev(ckbNavWrap.Value)

 

End Sub

Back to top

EnableAllRootNodeRules

The EnableAllRootNodeRules method enables or disables all rules and vectors for the root node.

Syntax

EnableAllRootNodeRules(Enable As Boolean)

Parameters

Parameter Required Description

Enable

Yes

Set to True to enable all root node rules; set to False to disable all root node rules.

Example

The following example enables all root node rules if ckbEnableAllFilterRules is checked. This example is taken from CxGrpNavBar and CxGrpGrid Example.

Sub ckbEnableAllFilterRules_EventChange()

Dim This : Set This = ckbEnableAllFilterRules

 

If ckbEnableAllFilterRules.Check = 1 Then

 

If cboLevel.Selection = 0 Then

GrpNavBar.X.EnableAllRootNodeRules True

Else

GrpNavBar.X.EnableAllRules _CInt(cboLevel.GetText(cboLevel.Selection)), True

End If

 

ListFilterRules

End If

 

End Sub

Back to top

EnableAllRules

The EnableAllRules method enables or disables all rules and vectors, either unilaterally, or for the specified level. Passing True for Enable enables all rules; passing False disables all rules.

Syntax

EnableAllRules(Level As Integer, Enable As Boolean)

Parameters

Parameter Required Description

Level

Yes

The zero-based level for which to enable or disable rules.

Enable

Yes

Set to True to enable all rules; set to false to disable all rules.

Example

The following example enables all rules for the specified level when ckbEnableAllFilterRules is selected. This example is taken from CxGrpNavBar and CxGrpGrid Example.

Sub ckbEnableAllFilterRules_EventChange()

Dim This : Set This = ckbEnableAllFilterRules

 

If ckbEnableAllFilterRules.Check = 1 Then

 

If cboLevel.Selection = 0 Then

GrpNavBar.X.EnableAllRootNodeRules True

Else

GrpNavBar.X.EnableAllRules _CInt(cboLevel.GetText(cboLevel.Selection)), True

End If

 

ListFilterRules

End If

 

End Sub

Back to top

EnableRootNodeRule

The EnableRootNodeRule method enables or disables a rule or vector of rules by name for the root node.

Syntax

EnableRootNodeRule(Name As String, Enable As Boolean)

Parameters

Parameter Required Description

Name

Yes

Specifies the name of the rule or vector to enable or disable.

Enable

Yes

Set to true to enable the rule or vector; set to false to disable the rule or vector.

Example

The following example enables the selected root node rule when btnEnableRule is selected. This example is taken from CxGrpNavBar and CxGrpGrid Example.

Sub btnEnableRule_EventClick()

Dim This : Set This = btnEnableRule

 

If lboDisabledRules.GetCurSel() < 0 Then

Exit Sub

End If

 

If cboLevel.Selection = 0 Then

GrpNavBar.X.EnableRootNodeRule _

lboDisabledRules.GetText(lboDisabledRules.GetCurSel()), True

Else

GrpNavBar.X.EnableRule CInt(cboLevel.GetText(cboLevel.Selection)), _

lboDisabledRules.GetText(lboDisabledRules.GetCurSel()), True

End If

 

ListFilterRules()

 

End Sub

Back to top

EnableRule

The EnableRule method enables or disables the specified rule or set of rules for the specified level. True enables the rule or vector; False disables it.

Syntax

EnableRule(Level As Integer, Name As String, Enable As Boolean)

Parameters

Parameter Required Description

Level

Yes

Specifies the zero-based level for the rule or vector.

Name

Yes

Specifies the name of the rule or vector.

Enable

Yes

Set to True to enable the rule or vector; set to False to disable the rule or vector.

Example

The following example enables the selected rule when btnEnableRule is selected. This example is taken from CxGrpNavBar and CxGrpGrid Example.

Sub btnEnableRule_EventClick()

Dim This : Set This = btnEnableRule

 

If lboDisabledRules.GetCurSel() < 0 Then

Exit Sub

End If

 

If cboLevel.Selection = 0 Then

GrpNavBar.X.EnableRootNodeRule _

lboDisabledRules.GetText(lboDisabledRules.GetCurSel()), True

Else

GrpNavBar.X.EnableRule CInt(cboLevel.GetText(cboLevel.Selection)), _

lboDisabledRules.GetText(lboDisabledRules.GetCurSel()), True

End If

 

ListFilterRules()

 

End Sub

Back to top

GetAllNodesAttrValues

The GetAllNodesAttrValues method returns the attribute values of all nodes for the specified level. The AttributeId parameter can be a string or a number.

Syntax

GetAllNodesAttrValues(Level As Integer, AttributeID As Variant) As Variant

Parameters

Parameter Required Description

Level

Yes

The zero-based level for which to retrieve attribute values.

AttributeID

Yes

The attribute ID can be specified by a string or a number.

Remarks

For AttributeID use the form "~criteria". (for example, "~attr0", "~cat")

Example

The following example stores the NodeID of each node from a specified level into an array, and displays each element of the array into a list box.

Sub GetAllAttr()

Dim attr

Dim attrList

 

attrList = GrpNavBar.GetAllNodesAttrValues(Level, "~nodeid")

 

lboAttributes.ResetContent

For Each attr In attrList

lboAttributes.AddString(attr)

Next

 

End Sub

Back to top

GetGrpNavBarCustomAttribute

The GetGrpNavBarCustomAttribute method retrieves the value of a custom attribute.

Syntax

GetGrpNavBarCustomAttribute(AttributeNameOrDesc As String) As String

Parameters

Parameter Required Description

AttributeNameOrDesc

Yes

The name or description of the attribute for which to set a value.

Example

The following example displays the value of a custom attribute in a message box.

Sub

 

MsgBox GrpNavBar.X.GetGrpNavBarCustomAttribute("grp_navbar_attribute_0")

 

End Sub

Back to top

GetRootNodeRuleNames

The GetRootNodeRuleNames method retrieves the names of enabled and disabled rules for the root node.

Syntax

GetRootNodeRuleNames(EnabledNames As Variant, DisabledNames As Variant)

Parameters

Parameter Required Description

EnabledNames

Yes

The list of enable rule names returned.

DisabledNames

Yes

The list of disabled rule names returned.

Example

The following example lists the enabled and disabled root node rule names. This example is taken from CxGrpNavBar and CxGrpGrid Example.

Sub ListFilterRules()

 

lboEnabledRules.ResetContent

lboDisabledRules.ResetContent

 

Dim aryEnabled, aryDisabled

 

If cboLevel.Selection = 0 Then

GrpNavBar.X.GetRootNodeRuleNames aryEnabled, aryDisabled

Else

GrpNavBar.X.GetRuleNames cboLevel.GetText(cboLevel.Selection), _aryEnabled, aryDisabled

End If

 

Dim i

For i = 0 To UBound(aryEnabled)

lboEnabledRules.AddString aryEnabled(i)

Next

 

For i = 0 To UBound(aryDisabled)

lboDisabledRules.AddString aryDisabled(i)

Next

 

End Sub

Back to top

GetRuleNames

The GetRuleNames method returns the names of all rules or sets of rules that have a configured name for the specified level. Separate arrays are returned for rules that are enabled and for rules that are disabled.

Syntax

GetRuleNames(Level As Integer, EnabledNames As Variant, DisabledNames As Variant)

Parameters

Parameter Required Description

Level

Yes

The zero-based level for which to retrieve rule names.

EnabledNames

Yes

The list of enable rule names returned.

DisabledNames

Yes

The list of disabled rule names returned.

Example

The following example lists the enabled and disabled rule names. This example is taken from CxGrpNavBar and CxGrpGrid Example.

Sub ListFilterRules()

 

lboEnabledRules.ResetContent

lboDisabledRules.ResetContent

 

Dim aryEnabled, aryDisabled

 

If cboLevel.Selection = 0 Then

GrpNavBar.X.GetRootNodeRuleNames aryEnabled, aryDisabled

Else

GrpNavBar.X.GetRuleNames cboLevel.GetText(cboLevel.Selection), _aryEnabled, aryDisabled

End If

 

Dim i

For i = 0 To UBound(aryEnabled)

lboEnabledRules.AddString aryEnabled(i)

Next

 

For i = 0 To UBound(aryDisabled)

lboDisabledRules.AddString aryDisabled(i)

Next

 

End Sub

Back to top

GetSelectedNodeAttrValue

The GetSelectedNodeAttrValue method returns the attribute value of the selected node for the specified level. The AttributeId parameter can be a string or a number.

Syntax

GetSelectedNodeAttrValue(Level As Integer, AttributeID As Variant) As String

Parameters

Parameter Required Description

Level

Yes

The zero-based level for which to retrieve an attribute value.

AttributeID

Yes

The attribute to be retrieved.

Remarks

For AttributeID use the form "~criteria". (for example, "~attr0", "~cat")

Example

The following example gets either the Description, Category, or Node ID, based on the user’s selection.

Sub GetSelAttr(userAttr)

 

If userAttr = "Description" Then

edtMessageBox.Text = GrpNavBar.X.GetSelectedNodeAttrValue(Level, "~desc")

Elseif userAttr = "Category" Then

edtMessageBox.Text = GrpNavBar.X.GetSelectedNodeAttrValue(Level, "~cat")

Elseif userAttr = "NodeID" Then

edtMessageBox.Text = GrpNavBar.X.GetSelectedNodeAttrValue(Level, "~nodeid")

End If

 

End Sub

Back to top

NavNext

The NavNext method navigates to the next target facility or node. Returns the number of the lowest-level combo box whose selection changed. The EventOnSelChangeLevel event is triggered when NavNext is called.

Syntax

NavNext(Wrap As Boolean) As Boolean

Parameters

Parameter Required Description

Wrap

Yes

If True, the selection wraps to the first node, if necessary

Example

The following example navigates to the next node when btnNavNext is clicked. This example is taken from CxGrpNavBar and CxGrpGrid Example.

Sub btnNavNext_EventClick()

Dim This : Set This = btnNavNext

 

Dim iLevel

iLevel = GrpNavBar.X.NavNext(ckbNavWrap.Value)

 

UpdateUI()

 

End Sub

Back to top

NavPrev

The NavPrev method navigates to the previous target facility or node. Returns the number of the lowest-level combo box whose selection changed. The EventOnSelChangeLevel event is triggered when NavPrev is called.

Syntax

NavPrev(Wrap As Boolean) As Boolean

Parameters

Parameter Required Description

Wrap

Yes

If True, the selection wraps to the last node, if necessary

Example

The following example navigates to the previous node when btnNavPrev is clicked. This example is taken from CxGrpNavBar and CxGrpGrid Example.

Sub btnNavPrev_EventClick()

Dim This : Set This = btnNavPrev

 

Dim iLevel

iLevel = GrpNavBar.X.NavPrev(ckbNavWrap.Value)

 

UpdateUI()

 

End Sub

Back to top

SelFirst

The SelFirst method selects the first node at the specified level.

Syntax

SelFirst(Level As Integer) As Boolean

Parameters

Parameter Required Description

Level

Yes

Sets the zero-based integer of the level.

Example

The following example selects the first node in the first level.

Sub FirstNode()

 

GrpNavBar.SelFirst (0)

edtMessageBox.Text = "First node selected"

 

End Sub

Back to top

SelLast

The SelLast method selects the last node at the specified level.

Syntax

SelLast(Level As Integer) As Boolean

Parameters

Parameter Required Description

Level

Yes

Sets the zero-based integer of the level.

Example

The following example selects the last node in the second level.

Sub LastNode()

 

GrpNavBar.SelLast (1)

edtMessageBox.Text = "Last node selected"

 

End Sub

Back to top

SelNext

The SelNext method selects the next item (facility attribute value or node) for the specified level. If Wrap is True, the selection wraps to the first item, if necessary. The EventOnSelChangeLevel event is triggered when SelNext is called.

Syntax

SelNext(Level As Integer, Wrap As Boolean) As Boolean

Parameters

Parameter Required Description

Level

Yes

Sets the zero-based integer of the level.

Wrap

Yes

If True, the selection wraps to the first node, if necessary.

Example

The following example selects the next node when btnNext is clicked. This example is taken from CxGrpNavBar and CxGrpGrid Example.

Sub btnNext_EventClick()

Dim This : Set This = btnNext

 

Dim iRet

iRet = GrpNavBar.X.SelNext(eboLevel.Text, ckbWrap.Value)

 

UpdateUI()

 

End Sub

Back to top

SelNode

The SelNode method selects the first node at the specified level that matches the criteria.

Syntax

SelNode(Level As Integer, Criteria As String) As Boolean

Parameters

Parameter Required Description

Level

Yes

Sets the zero-based integer of the level.

Criteria

Yes

Specifies filter criteria for the target node.

Remarks

For Criteria use the form "~criteria=value" (for example, "~desc=California", "~cat=S").

Example

The following example selects the node in the second level that has the description "California."

Sub SelCalif()

 

GrpNavBar.SelNode 1, "~desc=California"

edtMessageBox.Text = "California’s node selected"

 

End Sub

Back to top

SelPrev

The SelPrev method selects the previous item (facility attribute value or node) for the specified level. If Wrap is True, the selection wraps to the last item, if necessary. The EventOnSelChangeLevel event is triggered when SelPrev is called.

Syntax

SelPrev(Level As Integer, Wrap As Boolean) As Boolean

Parameters

Parameter Required Description

Level

Yes

Sets the zero-based integer of the level.

Wrap

Yes

If True, the selection wraps to the last node, if necessary.

Example

The following example selects the previous node when btnPrev is clicked. This example is taken from CxGrpNavBar and CxGrpGrid Example.

Sub btnPrev_EventClick()

Dim This : Set This = btnPrev

 

Dim iRet

iRet = GrpNavBar.X.SelPrev(eboLevel.Text, True)

 

UpdateUI()

 

End Sub

Back to top

SetGrpNavBarCustomAttribute

The SetGrpNavBarCustomAttribute method sets the value of a custom attribute.

Syntax

SetGrpNavBarCustomAttribute(AttributeNameOrDesc As String, Value As String)

Parameters

Parameter Required Description

AttributeNameOrDesc

Yes

Specifies the name or description of the attribute.

Value

Yes

Sets the value for the attribute.

Example

The following example specifies a custom attribute value:

Sub

 

GrpNavBar.X.SetGrpNavBarCustomAttribute "grp_navbar_attribute_0", "NEW_VAL"

 

End Sub

Back to top

SetTargetNode

The SetTargetNode method sets the target node that matches the criteria.

Syntax

SelTargetNode(Criteria As String) As Boolean

Parameters

Parameter Required Description

Criteria

Yes

Specifies filter criteria for the target node.

Example

The following example sets the target node to Cyg_Meter when the GrpNavBar object is started:

Sub GrpNavBar_EventInitialize()

Dim This : Set This = GrpNavBar

 

GrpNavBar.SetTargetNode("~desc=Cyg_Meter")

 

End Sub

Back to top

Let us know how we can improve this topic.

CygNet at weatherford.com

© 2020 Weatherford. All rights reserved.